import axios from '@/libs/axios.js'
import baseUrl from './index'
let studentIntegral = `${baseUrl}/self-study/studentIntegral`
let home = `${baseUrl}/self-study/home`
let jsonHeaders = {'content-type': 'application/json;charset=UTF-8'}
// （设计师）首页：培训模式图统计top5
// 工程状态
export const getDesignCountTran = (params) => {
    return axios({
        url: `${baseUrl}/self-study/home/designCountTran`,
        method: 'get',
        headers: jsonHeaders
    });
};
export const getContestUserTop = (params) => {
    return axios({
        url: `${baseUrl}/compete/integral/countContestUserTop`,
        method: 'get',
        headers: jsonHeaders
    });
};
export const getDrillUserTop = (params) => {
    return axios({
        url: `${baseUrl}/compete/integral/countDrillUserTop`,
        method: 'get',
        headers: jsonHeaders
    });
};
export const getFzUserTop = (params) => {
    return axios({
        url: `${baseUrl}/compete/integral/countFzUserTop`,
        method: 'get',
        params,
        headers: jsonHeaders
    });
};
export const getTaskDesignList = (params) => {
    return axios({
        url: `${baseUrl}/self-study/home/queryTaskDesignList`,
        method: 'get',
        params,
        headers: jsonHeaders
    });
};
// 获取基础培训热门课程课件统计
export const getCountHotCourseAndExp = () => {
    return axios({
        url: `${home}/countHotCourseAndExp`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 获取首页统计试图需要的数据
export const getStatisticsData = params => {
    return axios({
        url: `${home}/pie`,
        method: 'get',
        headers: jsonHeaders,
        params
    })
}

export const queryStudentIntegral = params => {
    return axios({
        url: `${studentIntegral}/statistic/newDirectionType/scoresAndCovered/`,
        method: 'get',
        headers: jsonHeaders,
        params
    })
}

export const querySkillTreeCovered = params => {
    return axios({
        url: `${studentIntegral}/statistic/skillTree/role/covered`,
        method: 'get',
        headers: jsonHeaders,
        params
    })
}

// 部署工程
export const deployProject = id => {
    return axios({
        url: `${baseUrl}/topo-edit/projects/${id}/deploy/async`,
        method: 'post',
        headers: jsonHeaders,
    })
}

export const getDeployProgress = deployId => {
    return axios({
        url: `${baseUrl}/topo-edit/deploy/${deployId}/record`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 工程状态
export const getProData = (params) => {
    return axios({
        // url: `${baseUrl}/topo-edit/projects/list`,
        url: `${baseUrl}/topo-edit/projects/status/count`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 虚拟机总量 正常 异常
export const getVmsData = (params) => {
    return axios({
        url: `${baseUrl}/topo-edit/projects/sort/vm?sortBy=${params}&order=desc`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 工程资源 CPU MEM DISK NW
export const getProResource = (params) => {
    return axios({
        url: `${baseUrl}/topo-edit/projects/sort/sourceUsed?sortBy=${params}&order=desc`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 修改工程
export const modifyProject = (data) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/update`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 删除工程
export const delProject = (id) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/delete/${id}`,
        method: 'delete',
        headers: jsonHeaders,
    })
}
// 工程中间状态
export const queryProjectstatus = (id) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 清空部署工程
export const clearDeloyPro = (id,data) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/clear/${id}`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 查看工程的分享人
export const queryShareOfPro = (id) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/share/users/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 查看单位内设计师
export const queryCompanyMembers = (params) => {
    return axios({
        url: `${baseUrl}/identity/company/users`,
        method: 'get',
        params:params,
        headers: jsonHeaders,
    })
}
// 将工程分享给某设计师
export const shareDesign = (id,data) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/shareMyProject/${id}`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 联盟内单位
export const queryShareStatus = (id) => {
    return axios({
        url: `${baseUrl}/guidance/projects/exists?projectId=${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 设备信息
export const deviceInfo = (id) => {
    return axios({
        url: `${baseUrl}/topo-edit/topo/projects/${id}/vms?vmType=PUB`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 查询端口信息
export const queryPortInfo = (id) => {
    return axios({
        url: `${baseUrl}/topo-edit/port/findPortsByDeviceId/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// cidr接口
export const getCidr = (allianceProId,id) => {
    return axios({
        url: `${baseUrl}/topo-edit/topo/projects/${allianceProId}/dhcpServers/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 联盟内分享的提交
export const allianShareSubmit = (data) => {
    return axios({
        url: `${baseUrl}/guidance/projects/register`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 取消联盟分享
export const cancelAllianShare = (id) => {
    return axios({
        url: `${baseUrl}/guidance/projects/unregister?projectId=${id}`,
        method: 'post',
        headers: jsonHeaders,
    })
}
// 工程可用域
export const zoneOfProject = (id) => {
    return axios({
        url: `${baseUrl}/topo-edit/zones/project/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 用户可用域
export const zoneOfuser = () => {
    return axios({
        url: `${baseUrl}/identity/company/zones`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 修改可用域
export const modifyZone = (projectZoneId,data) => {
    return axios({
        url: `${baseUrl}/topo-edit/zones/project/${projectZoneId}`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 创建空白工程
export const creatBlankPro = (id,data,mode) => {
    return axios({
        url: `${baseUrl}/topo-edit/project/import/async?templateId=${id}&mode=${mode}`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 镜像列表
export const imgList = (data) => {
    return axios({
        url: `${baseUrl}/virtual/image/listData`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 配额列表
export const flavorList = (data) => {
    return axios({
     //   url: `${baseUrl}/virtual/flavor/list`,
        url: `${baseUrl}/resource-manager/flavor/list`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 批量创建提交
export const batchSubmit = (data) => {
    return axios({
        url: `${baseUrl}/topo-edit/projects/json/distribution`,
        method: 'post',
        data:JSON.stringify(data),
        headers: jsonHeaders,
    })
}
// 获取单位资源数据
export const getComResource = () => {
    return axios({
        url: `${baseUrl}/identity/company/resources`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 操作记录
export const logs = (params) => {
    return axios({
        url: `${baseUrl}/openrange-log/log/logs`,
        method: 'get',
        params:params,
        headers: jsonHeaders,
    })
}
// 日志逐天数据
export const manyDayDateRangeTotal = (params) => {
    return axios({
        url: `${baseUrl}/openrange-log/log/manyDayDateRangeTotal`,
        method: 'get',
        headers: jsonHeaders,
        params:params,
    })
}
// 日志逐时数据
export const manyHourDateRangeTotal = (params) => {
    return axios({
        url: `${baseUrl}/openrange-log/log/oneDayDateRangeTotal`,
        method: 'get',
        headers: jsonHeaders,
        params:params,
    })
}

//导入模板
export const inPutTemFile = params => {
    return axios({
        url: `${baseUrl}/resource-manager/template/add`,
        method: 'post',
        data: params,
        headers: jsonHeaders,
    })
}
//下载Excel模板
export const downLoadExcel = () => {
    return axios({
        url: `${baseUrl}/topo-edit/excel/define/topo/template`,
        method: 'get',
        headers: jsonHeaders,
    })
}

//新首页统计
// 资源统计
export const categoryStatistics = () => {
    return axios({
        url: `${baseUrl}/self-study/sd/designer/category`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 用户排行统计
export const userRankStatistics = (params) => {
    return axios({
        url: `${baseUrl}/self-study/sd/designer/rank`,
        method: 'get',
        params,
        headers: jsonHeaders,
    })
}

//用户活跃度Top3
export const userEngagementStatistics = () => {
    return axios({
        url: `${baseUrl}/self-study/sd/designer/top`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 删除工程模版
export const deleteProjectTemplate = templateId => {
    return axios({
        url: `${baseUrl}/resource-manager/template/${templateId}`,
        method: 'delete',
        headers: jsonHeaders,
    })
}